package project11;

public class Test {
    public static void main(String[] args) {
        ColaEmployee[] std=new ColaEmployee[10];
        int i=0;
        std[0]=new SalaryEmployee("小李",3,10000);
        std[1]=new HourlyEmployee("小王",4,172,100);
        std[2]=new SalesEmployee("小刘",7,160000,0.1);
        company.setMonth(3);
        for(i=0;i<3;++i)
        {
            company.getmysalary(std[i]);
        }
    }

}
class ColaEmployee {
    private String name;
    private int birthday;

    public ColaEmployee() {
    }
    public double getsalary(int month)
    {
        double salary=0;
        if(month==getBirthday())
        {
            return salary+100;
        }
        else
            return salary;
    }
    public void setBirthday(int birthday) {
        this.birthday = birthday;
    }

    public String getName() {
        return name;
    }

    public int getBirthday() {
        return birthday;
    }

    public ColaEmployee(String name, int birthday) {
        this.name = name;
        this.birthday = birthday;
    }
}
class SalaryEmployee extends ColaEmployee
{
    private double salary;

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public double getSalary() {
        return salary;
    }

    public SalaryEmployee(String name, int birthday, double salary) {
        super(name, birthday);
        this.salary = salary;
    }

    public SalaryEmployee() {
    }

    public double getsalary(int month)
    {
        if(month==getBirthday())
        {
            return (salary+100);
        }
        else
            return salary;
    }
}
class HourlyEmployee extends ColaEmployee
{
    private int hour;
    private int hoursalary;
    @Override
    public double getsalary(int month) {
        double salary;
        if(hour<=160)
            salary=hour*hoursalary;
        else
            salary=160*hoursalary+(hour-160)*hoursalary*1.5;
        if(month==getBirthday())
        {
            return salary+100;
        }
        else
            return salary;
    }

    public HourlyEmployee(String name, int birthday, int hour, int hoursalary) {
        super(name, birthday);
        this.hour = hour;
        this.hoursalary = hoursalary;
    }

    public HourlyEmployee() {
    }
}
class SalesEmployee extends ColaEmployee
{
    private double Monthlysales;
    private double Submissionrate;

    @Override
    public double getsalary(int month) {
        double salary;
        salary=Monthlysales*Submissionrate;
        if(month==getBirthday())
        {
            return salary+100;
        }
        else
            return salary;
    }

    public SalesEmployee(String name, int birthday, double monthlysales, double submissionrate) {
        super(name, birthday);
        Monthlysales = monthlysales;
        Submissionrate = submissionrate;
    }
}
class company
{
     static int month;

    public company() {
    }

    public static void setMonth(int month) {
        company.month = month;
    }

    public static int getMonth() {
        return month;
    }

    public static void getmysalary(ColaEmployee b)
    {
        String format=String.format("%.0f",b.getsalary(month));
        System.out.println(b.getName()+"此月工资为："+Double.parseDouble(format));
    }

}